import $axios from "../commen/http";
import { Message } from "element-ui"

export async function login(data){
  let res = await $axios.post("/userlogin", data)
  Message.success('登录成功')
  return res.list;
}

// 获取菜单列表
export async function getMenuList(data){
  let res = await $axios.get("/menulist", {
    params: data
  })
  return res;
}

// 删除菜单
export async function delMenu(data){
  let res = await $axios.post("/menudelete", data)
  return res;
}
// 获取角色
export async function getRole(id){
  let res = await $axios.get("/rolelist", {
    params: {id}
  });
  return res;
}
// 获取商品的总条数，用于计算分页
export async function goodscount(){
  let res = await $axios.get("/goodscount");
  return res;
}
// 获取分页数据，点那一页看哪一页
export async function goodslist(data){
  let res = await $axios.get("/goodslist", {
    params: data
  });
  return res;
}